<template>
	<view class="newsDetailPage">
		<view class="title">{{item.title}}</view>
		<view class="info">
			<text>发表时间 : {{item | formDate}}</text>
			<text>浏览 : {{item.click}}</text>
		</view>
		<view class="content">
			<rich-text :nodes="item.data"></rich-text>
		</view>
	</view>
</template>

<script>
	import Time from "@/common/js/time.js";
	export default {
		name: "newsDetail",
		onLoad() {
			this.getOpenerEventChannel().on('newsPage', res => {
				this.item = res.item;
			});
		},
		data() {
			return {
				item: null,
				// 时间单独处理，不然会报错了。
				tiems: void 0,
			};
		},
		filters: {
			formDate(value) {
				return new Time().formTime(Number(value.add_time));
			}
		}
	}
</script>

<style lang="scss">
	.title {
		padding: 20rpx;
		letter-spacing: 4rpx;
		font-size: 42rpx;
		@include textEllipsis;
	}

	.info {
		padding: 0 20rpx;
		@include flexBetweenCenter;

		>text {
			font-size: 26rpx;
		}
	}

	.content {
		padding: 20rpx;
		color: #999;
	}
</style>
